Repository navigation
fix(pm): dispatch-gates derives the change set with -z, so a non-ASCII governed path keeps its tier - #33998
Merged
Conversation
…I governed path keeps its tier changedPathsFromGit read its three path lists (committed, uncommitted, untracked) line by line without -z. Git C-quotes a path holding a non-ASCII byte or a control character, the quoted spelling matches no glob, and a skills/** file derived no tier and no gate family; an untracked one was counted as unreadable. The lists now go through one reader that splices -z in and splits on NUL, untrimmed. A real-git self-test scenario carries one such name per read (two Chinese names, one newline name), with a control that reads the same branch the old way and comes back quoted, tierless and gateless. Claude-Session: https://claude.ai/code/session_01ADHkmPfzYmYaFdzt3TJ9w2 Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
domain:skills#1 · os-steve · session_01ADHkmPd7uRqHauEehGPr19 席位核对 · ACCEPT · head
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Steve · project thread
Fixes #33847
Clause-②: no
Metadata-protocol: none
维护者速读
dispatch-gates.mjs的changedPathsFromGit读变更路径(已提交、未提交、未跟踪三份清单)时改成加-z、按 NUL 切分,三份清单走同一个读取函数,-z由该函数统一插入。-z时 git 会把含中文等非 ASCII 字符或换行的路径打印成带引号的转义串,它对不上任何 glob,于是skills/**下这样命名的受管文件在派发时算不出复审档位,派生的门禁清单也漏掉它;未跟踪的这种文件还被记成「读不到、0 行」。scripts/pm/**一个工具脚本和它的自测,不发布任何包;所有 ASCII 路径的读数逐字节不变。回滚即还原本 PR。scripts/pm/dispatch-gates.mjs的gitPathList(新读取函数)与changedPathsFromGit的三处调用;自测文件里quoted-names场景。skills/objectstack-data/文档.md后跑node scripts/pm/dispatch-gates.mjs --tier,预期 stderr 列出原样的中文路径,stdout 给出契约复审档位(修复前是带引号的转义串、无档位)。What changes
changedPathsFromGit(it feeds--tier,--commandsand the changed-line size) read its three path lists line by line, with no-z:diff --name-only --no-renames MERGE_BASE HEAD, split on newline, trimmeddiff -z --name-only --no-renames MERGE_BASE HEAD, split on NUL, not trimmeddiff --name-only --no-renames HEAD, samediff -z …, samels-files --others --exclude-standard, samels-files -z …, samechangedLinesFromGitfallback (nountrackedpassed)-zreadGit C-quotes a path holding a non-ASCII byte, a double quote or a control character (a file named in Chinese prints as a quoted octal string), and that spelling starts with a quote mark, so it matched no glob. Measured on a real repo before the fix: a committed
skills/x/file named in Chinese plus an untracked one derivedtier: null, and the untracked one was counted as 1 unreadable file of 0 lines. After: both raw, tierCONTRACT_REVIEW_TIER, 0 unreadable.All four reads now go through one reader,
gitPathList, which splices-zin after the subcommand itself, so no caller in this file can list paths the other way. The oldgitLineshad no other caller and is gone. Not done, per the card:core.quotePath=falsealone, which would still split a newline name in two.Not changed: the size read
diff --numstat -M(summed byparseNumstatincheck-governed-merges.mjs) only adds the two counts, which quoting never touches; the same call was left as is in #33804 for the same reason.Tests
node scripts/pm/dispatch-gates.mjs --self-teston acb82a3: 2520 cases pass, exit 0 (lock VERDICT command-exit 0). Five new cases, in the slow tier's real-git section, on a fixture repo that setscore.quotePath trueitself so it quotes on any machine. Each of the three reads carries one name git quotes: a committed file named in Chinese, an uncommitted edit to another, and an untracked file whose name holds a newline.-z) of the same branch quotes all three, and they derive no tier and name no gate family.CONTRACT_REVIEW_TIERthroughskills/**(3 hits).check:skill-*gate families, the ones the derived--commandslist is built from.No existing test was edited.
Ablation: the old reader restored on disk, exactly the four new rows red, restored (head acb82a3)
Each mutation through
node scripts/ablation-replace.mjs(anchor hits 1 then 0 on disk, blob changed), the self-test underos-verify-lock.sh; restore: blob == HEAD (6343de57fbce) andgit diff HEADempty, both legs.Acceptance notes
derivationProvenanceprints one path per stderr line, so a path with a newline in its name now prints raw across two lines there. That is display only (stdout and the tier are unaffected); not changed.Verification
Local subset on acb82a3 (final head):
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 30 commands; all 30 exit 0 (each exit captured before any pipe).--ranwith every line annotated:: exit N: 30 derived, 30 run, 0 NOT-MEASURED, 0 UNRUN (a derived zero, all 30 recorded an exit code).pnpm check:pm-dispatch-gatesis in that 30 (its fast tier, 2205 cases); the full both-tier battery is the 2520 above. The script's other callers ofchangedPathsFromGitare onlycheck-dispatch-gates.mjs, covered there. No package touched, so no build closure and no package test is owed; CI runs the rest.The 30 commands and their exit codes
Generated by Claude Code